home *** CD-ROM | disk | FTP | other *** search
- #include <genstub.c>
-
- LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
- {
- static SYSTEMTIME stSystemTimeEntry;
-
- switch (uMsg)
- {
- case WM_CREATE:
- GetSystemTime( &stSystemTimeEntry );
- return( DefWindowProc(hWnd, uMsg, wParam, lParam ) );
- case WM_COMMAND:
- switch( LOWORD( wParam ) )
- {
- case IDM_TEST: // Add an hour to the clock.
- {
- SYSTEMTIME st;
- TCHAR szBuffer[128];
-
- GetLocalTime( &st );
- // Add one hour.
- st.wHour++;
- if (st.wHour==23)
- st.wHour = 0; // Wrap to next day.
- SetLocalTime( &st );
- // Display new local time.
- wsprintf(szBuffer, "The new time is %d:%d:%d.%d",
- st.wHour, st.wMinute, st.wSecond,
- st.wMilliseconds );
- MessageBox( hWnd, szBuffer, "Added One Hour",
- MB_OK );
- }
- break;
- case IDM_EXIT:
- DestroyWindow( hWnd );
- break;
- break;
- }
- break;
- case WM_DESTROY:
- SetSystemTime( &stSystemTimeEntry );
- PostQuitMessage( 0 );
- break;
- default:
- return( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
- }
- return( NULL );
- }